//
//  GameData.swift
//  MILHorizontalCollectionViewExample
//
//  Created by dengwei on 16/5/10.
//  Copyright © 2016年 IBM. All rights reserved.
//


import UIKit

class GameData: NSObject, DictModelProtocol {
    
    var code: Int = -1
    var msg: String?
    var data: [Game]?
    
    static func customClassMapping() -> [String : String]? {
        return ["data" : "\(Game.self)"]
    }
    
    class func loadMyGameData(completion:(data: GameData?, error: NSError?) -> Void) {
        let path = NSBundle.mainBundle().pathForResource("Game", ofType: nil)
        let data = NSData(contentsOfFile: path!)
        if data != nil {
            let dict: NSDictionary = (try! NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments)) as! NSDictionary
            let modelTool = DictModelManager.sharedManager
            let data = modelTool.objectWithDictionary(dict, cls: GameData.self) as? GameData
            completion(data: data, error: nil)
        }
    }
}


class Game: NSObject {
    
    var id: String?
    var title: String?
    var logo: String?
   
}